package ru.ifmo.ipimenov.ewf_svn.standalone.model.list;

import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;

import javax.swing.*;
import java.util.List;
import java.util.ArrayList;

import ru.ifmo.ipimenov.ewf_svn.standalone.model.db.State;

/**
 * @author: Ilya Pimenov
 * Scartel Starlab company
 */
public class StateModel extends AbstractListModel {
    /**
     * Logger for all purposes
     */
    private static Log log = LogFactory.getLog(Model.class);

    List<State> l;

    public void add(State s){
        l.add(s);
    }

    public void remove(State s){
        l.remove(s);
    }

    public StateModel(){
        this.l = new ArrayList<State>();
    }

    public StateModel(List<State> l) {
        this.l = l;
    }

    public int getSize() {
        return l.size();
    }

    public Object getElementAt(int index) {
        return  l.get(index).getName();
    }

    public int indexOf(State state){
        return l.indexOf(state);
    }

    public State getState(int index){
        return l.get(index);
    }
}